const ProjectModel = require('../do/models/');
class ProjectService{
    async getProject(id){
        if(!id){
            return await ProjectModel.findAll();
        }
        return await ProjectModel.findOne({
            where:{
                id:id
            }
        })
    }
    async createProject(data){
        return await ProjectModel.create(data);
    }
    async destroyProject(id){
        return await ProjectModel.destroy({
            where:{id:id}
        })
    }
    async updateProject(id,data){
        let { projectimg,projectname,projectlink,status } = data;
        if(projectimg){
            return await ProjectModel.updata({
                projectimg:projectimg,
                projectname:projectname,
                projectlink:projectlink,
                status:status
            })
        }
    }
}
module.exports = new ProjectService();